import 'package:flutter_wan_android/entity/article_entity.dart';
import 'package:flutter_wan_android/entity/project_tree_entity.dart';
import 'package:flutter_wan_android/provider/view_state_model_list.dart';
import 'package:flutter_wan_android/provider/view_state_model_list_refresh.dart';
import 'package:flutter_wan_android/service/wan_android_repository.dart';

///
/// 获取项目分类
///
class ProjectTreeModel extends ViewStateListModel<ProjectTreeEntity> {
  @override
  Future<List<ProjectTreeEntity>> loadData() async {
    return await WanAndroidRepository.getProjectTree();
  }
}

///
/// 根据项目分类获取文章列表
///
class ProjectListModel extends ViewStateRefreshListModel<ArticleEntity> {
  int cid;

  ProjectListModel(this.cid);

  @override
  Future<List<ArticleEntity>> loadData({int pageNum}) async {
    return await WanAndroidRepository.getProjectList(pageId: pageNum, chapterId: cid);
  }
}
